package cn.aitrox.ry.service.config.dao.impl;

import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.config.dao.ComponentDao;
import cn.aitrox.ry.service.config.entity.ComponentEntity;
import cn.aitrox.ry.service.config.mapper.ComponentMapper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ComponentDaoImpl extends BaseDaoImpl<ComponentEntity> implements ComponentDao {

    @Autowired
    private ComponentMapper mapper;

    @Override
    public PageInfo<ComponentEntity> search(Integer page, Integer pageSize, List<Integer> ids, String likeName) {
        return searchByCustom(page, pageSize, new MapperSqlCallback<ComponentEntity>() {
            @Override
            public List<ComponentEntity> invoke() {
                return mapper.findByCond(ids, likeName);
            }
        });
    }
}
